package com.lyrcsoft.lifecycle;

import org.springframework.context.SmartLifecycle;
import org.springframework.stereotype.Component;

/**
 * @author fujc-dev@qq.com
 * @date 2023/7/11 11:15
 */
@Component
public class MySmartLifecycle implements SmartLifecycle {

	private Boolean isRunning = false;

	@Override
	public void start() {
		System.out.println("1");
		isRunning = true;
	}

	@Override
	public void stop() {
		// Spring 停止的时候会去判断，容器是否运行
		System.out.println("2");
	}

	@Override
	public boolean isRunning() {
		return isRunning;
	}
}
